package com.nulldev.util.crypto.api2;

import java.nio.charset.Charset;

import com.nulldev.util.java.utils.rt.Warning;
import com.nulldev.util.logging.Logger;
import com.nulldev.util.logging.LoggerFactory;

@Deprecated
public abstract class Cryptable {
	
	protected final Logger log = LoggerFactory.getLogger();
	
	static {
		LoggerFactory.getLogger().error("Cryptable a.k.a CryptoAPI 2-3 is no longer supported, please switch over to encryptAPI.");
	}
	
	private String CRYPT_NAME;
	public abstract String encrypt(final String object, final String pass);
	@Warning("Feature is under partial deperication due to CryptAPI 3 development.")
	public abstract String encrypt(final String object, final String pass, final Charset charset);
	public abstract String decrypt(final String object, final String pass);
	@Warning("Feature is under partial deperication due to CryptAPI 3 development.")
	public abstract String decrypt(final String object, final String pass, final Charset charset);

	public Cryptable(final String id) {
		this.CRYPT_NAME = id;
	}

	public String id() {
		return this.CRYPT_NAME;
	}
	
	private final EncryptionUtil.Types typx = EncryptionUtil.getType(this.CRYPT_NAME);
	public EncryptionUtil.Types getType() {
		return this.typx;
	}
	
	public String toPGPString(final String in) {
		return "Unsupported Feature.";
	}
	
	public String toPGPString(final String in, final String key) {
		return this.toPGPString(in);
	}
	
	public String decryptFromPGP(final String in, final String key) {
		return "Unsupported Feature.";
	}

}
